package com.syl.whitelist.config;

import com.syl.whitelist.JoinPoint;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @ClassName WhiteListAutoConfigure
 * @Description 白名单自动配置器
 * @Author YunLong
 * @Date 2022/8/19 14:35
 */

@Configuration
@EnableConfigurationProperties(WhiteListProperties.class)
@ConditionalOnClass(WhiteListProperties.class)
public class WhiteListAutoConfigure {

    @Bean("whiteListConfig")
    @ConditionalOnMissingBean
    public String WhiteListConfig(WhiteListProperties whiteListProperties) {
        return whiteListProperties.getUsers();
    }

    @Bean
    @ConditionalOnMissingBean
    public JoinPoint whitelistPoint(){
        return new JoinPoint();
    }


}
